﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;

namespace ConfExpert.Forms.Sistem
{
    public partial class UretimKonsolide : XForm
    {
        public UretimKonsolide()
        {
            InitializeComponent();
        }

        private void UretimKonsolide_Load(object sender, EventArgs e)
        {
            deBaslangic.EditValue = new DateTime(2016, 1, 1);
            deBaslangic.EditValueChanged += deBaslangic_EditValueChanged;
            gridView1.Init("GetUretimKonsolide", chkHepsiniGoster.Checked, deBaslangic.EditValue.ToDate());
            gridView1.SetCaptions("1:Model", "2:Artikel", "3:Renk", "4:OrderNr");
            chkHepsiniGoster.CheckedChanged += chkHepsiniGoster_CheckedChanged;

            gridView1.AddSummary();
            gridView1.BestFitColumns();
        }

        void chkHepsiniGoster_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Rfrsh();
            deBaslangic.Visibility = chkHepsiniGoster.Checked ? DevExpress.XtraBars.BarItemVisibility.Always : DevExpress.XtraBars.BarItemVisibility.Never;
        }

        void deBaslangic_EditValueChanged(object sender, EventArgs e)
        {
            Rfrsh();
        }

        private void Rfrsh()
        {
            gridView1.RefreshDataSource("GetUretimKonsolide", chkHepsiniGoster.Checked, deBaslangic.EditValue.ToDate());
            gridView1.BestFitColumns();
        }
    }
}
